<%inherit file="../myun_base.html" />

<%block name="innav">
<li><a href="${ reverse_url('myun:instance') }">${ _("Instances") }</a></li>
</%block>

<%block name="submain">

<script type="text/javascript">
  just_active_myself("#myun-instance-entry");
</script>

<div><a class="btn" href="${ reverse_url('myun:instance:global_password_edit') }"><i class="icon-edit icon-large"></i> ${ _("Edit instance's default password.") }</a></div>

<br>

% if INSTANCE_LIST:
<div id="instance-list">

  <div class="y-checkarea">
    <table class="table table-hover table-bordered table-striped">
      <thead>
        <tr>
          <th><i class="icon-check-empty y-check-all"></i></th>
          <th>ID</th>
          <th><i class="icon-exchange"></i></th>
          <th>${ _("Name") }</th>
          <th>${ _("CPU") }</th>
          <th>${ _("Memory") }</th>
          <th>${ _("Storage") }</th>
          <th>${ _("Appliance") }</th>
        </tr>
      </thead>
      <tbody>
        % for I in INSTANCE_LIST:
        <tr class="y-check-line" id="i${ I.id }">
          <td><i class="icon-check-empty y-check"></i></td>
          <td class="y-id">${ I.id }</td>
          <td>${ I.status_icon }</td>
          <td>
            <a href="${ reverse_url('myun:instance:view') }?id=${ I.id }">${ I.name }</a>
            % if I.isprivate:
            <i class="icon-eye-close"></i>
            % endif
          </td>
          <td>${ I.cpus }</td>
          <td>${ I.memory }</td>
          <td>${ I.storage }</td>
          <td><a href="${ reverse_url('appliance:view') }?id=${ I.appliance_id }" target="_blank">${ I.appliance.name }</a></td>
        </tr>
        % endfor
      </tbody>
      <tfoot>
        <tr>
          <td><i class="icon-check-empty y-check-all"></i></td>
          <td colspan="7">
            <a href="" class="y-select-all">${ _("Select All") }</a>
            <span class="divider">/</span>
            <a href="" class="y-unselect-all">${ _("Unselect All") }</a>
            <span class="divider">/</span>
            <a href="" class="y-select-reverse">${ _("Select Reverse") }</a>
          </td>
        </tr>
      </tfoot>
    </table>
    ${ page_html }

    <div>
      <div class="btn-group">
        <a class="btn y-action-nonzero disabled action-setattr" href="${ reverse_url('instance:attr_set') }?attr=isprivate&value=true"><i class="icon-eye-close"></i> ${ _("Private") }</a>
        <a class="btn y-action-nonzero disabled action-setattr" href="${ reverse_url('instance:attr_set') }?attr=isprivate&value=false"><i class="icon-eye-open"></i> ${ _("Public") }</a>
      </div>
    </div>
  </div>

</div>

<div style="display:none;" id="xsrf-cookie">${ xsrf_cookie }</div>

<script type="text/javascript" src="${ theme_url('js/myun-instance.js') }"></script>

<script type="text/javascript">
  y_checkarea_binding();
  instance_list_attr_set(".action-setattr");
</script>

% else:
<div class="hero-unit">${ _("You have not any instance yet !") }</div>
% endif


</%block>
